# Airport Search API

## Description

Airports search API is a RESTful web service for searching airports data.

## Requirements

- PHP ^8.1
- Composer
- Elasticsearch ^8.8

## API Endpoints

#### Search Endpoint

    URL: /api/search
    Method: GET
    URL Params:
    query=[string] - The query string to search for.
    Success Response:
        Code: 200
        Content: JSON array of matching airports

## Installation Steps

1. **Install the Composer dependencies:**

    ```
    composer install
    ```

2. **Setup the Environment File:**

    ```
    cp .env.example .env
    ```

3. **Configure Elasticsearch comma-separated hosts in .env file**
    ```
    ELASTICSEARCH_HOSTS=localhost:9200,localhost:9201
   ```

4. **Generate the application key:**

    ```
    php artisan key:generate
    ```

5. **Create the Elasticsearch Index:**

    ```
    php artisan update-airports-index
    ```

6. **Start the Laravel server:**

    ```
    php artisan serve
    ```

## Running the Tests

```
php artisan test
```

